﻿Public Class SOFTWAREGROUPEDIT
    Dim connect As CONDB = CONDB.NewConnection()

    Public Sub New(prgGroupid As String, prgGroupName As String, prgGroupStatus As Integer)

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        groupSWID.Text = prgGroupid
        GPRGNAMETxt.Text = prgGroupName

        If prgGroupStatus = 1 Then
            masgrpprgStatusChk.Checked = True
        Else
            masgrpprgStatusChk.Checked = False
        End If
    End Sub

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub editMasgrpprg_Click(sender As Object, e As EventArgs) Handles editMasgrpprg.Click
        If GPRGNAMETxt.Text.Length.ToString > 0 Then
            Dim editStat As Integer
            editStat = MsgBox("ท่านต้องการแก้ไขข้อมูลกลุ่มโปรแกรมใช่หรือไม่", MsgBoxStyle.OkCancel)

            If editStat = 1 Then
                Dim objEditSWGroupName As New SOFTWAREGROUPCLASS
                objEditSWGroupName.GPRGID_ = groupSWID.Text
                objEditSWGroupName.GPRGNAME_ = GPRGNAMETxt.Text
                objEditSWGroupName.masgrpprgSTATUS_ = masgrpprgStatusChk.Checked
                
                If objEditSWGroupName.editMasgrpprg = True Then
                    MsgBox("ท่านได้ทำการแก้ไขข้อมูลกลุ่มโปรแกรมเรียบร้อยแล้ว")
                    DialogResult = Windows.Forms.DialogResult.OK
                    Me.Close()
                End If
            Else
                MsgBox("โปรดกรุณาระบุชื่อกลุ่มซอฟต์แวร์")
            End If
        End If
    End Sub

    Private Sub SOFTWAREGROUPEDIT_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub
End Class